/**
 * Created by sallyxie on 2017/6/17.
 */
function navigation() {
    this.json = [{
        id:1,
        name:"汇总图",
        icon:"fa fa-laptop",
        link:"index.html",
        children:[]
    },{
        id: 1,
        name: "日志分析",
        icon: "fa fa-inbox",
        link:"javascript:;",
        children: [
            {id:2,name:"手机汇总",icon:"",link:"javascript:;",children:[
                {id:2,name:"综合信息",icon:"",link:"javascript:;",children:[
                    {id:2,name:"公司信息",icon:"",link:"companyinfo.html",navname:"日志分析.手机汇总.综合信息.公司信息",children:[]},
                    {id:2,name:"网站信息",icon:"",link:"websiteinfo.html",navname:"日志分析.手机汇总.综合信息.网站信息",children:[]},
                    {id:2,name:"预定义域名",icon:"",link:"predefinedomain.html",navname:"日志分析.手机汇总.综合信息.预定义域名",children:[]},
                    {id:2,name:"域名信息",icon:"",link:"javascript:;",navname:"日志分析.手机汇总.综合信息.域名信息",children:[]},
                    {id:2,name:"域信息",icon:"",link:"javascript:;",navname:"日志分析.手机汇总.综合信息.域信息",children:[]},
                    {id:2,name:"错误域名统计",icon:"",link:"javascript:;",navname:"日志分析.手机汇总.综合信息.错误域名统计",children:[]},
                    {id:2,name:"应用软件分析",icon:"",link:"javascript:;",navname:"日志分析.手机汇总.综合信息.应用软件分析",children:[]},
                    {id:2,name:"地域分析",icon:"",link:"javascript:;",navname:"日志分析.手机汇总.综合信息.地域分析",children:[]},
                    {id:2,name:"汇总",icon:"",link:"javascript:;",navname:"日志分析.手机汇总.综合信息.汇总",children:[]}
                ]},
                {id:2,name:"资源视图管理",icon:"",link:"javascript:;",navname:"",children:[
                    {id:2,name:"资源占比",icon:"",link:"javascript:;",navname:"日志分析.手机汇总.资源视图管理.资源占比",children:[]},
                    {id:2,name:"热点域名分布区域图",icon:"",link:"javascript:;",navname:"日志分析.手机汇总.资源视图管理.热点域名分布区域图",children:[]},
                    {id:2,name:"热点域名分布流向图",icon:"",link:"javascript:;",navname:"日志分析.手机汇总.资源视图管理.热点域名分布流向图",children:[]}
                ]},
                {id:2,name:"热点资源统计",icon:"",link:"javascript:;",children:[
                    {id:2,name:"TOPN网站本网率统计",icon:"",link:"javascript:;",navname:"日志分析.手机汇总.热点资源统计.TOPN网站本网率统计",children:[]},
                    {id:2,name:"热点网站本网率统计图",icon:"",link:"javascript:;",navname:"日志分析.手机汇总.热点资源统计.热点网站本网率统计图",children:[]},
                    {id:2,name:"重点网站分类统计图",icon:"",link:"javascript:;",navname:"日志分析.手机汇总.热点资源统计.重点网站分类统计图",children:[]},
                    {id:2,name:"热点域名排名变化分析",icon:"",link:"javascript:;",navname:"日志分析.手机汇总.热点资源统计.热点域名排名变化分析",children:[]},
                    {id:2,name:"热点域名资源分析",icon:"",link:"javascript:;",navname:"日志分析.手机汇总.热点资源统计.热点域名资源分析",children:[]}
                ]},
                {id:2,name:"本网率相关",icon:"",link:"javascript:;",navname:"",children:[
                    {id:2,name:"出网内容",icon:"",link:"javascript:;",navname:"日志分析.手机汇总.本网率相关.出网内容",children:[]},
                    {id:2,name:"网内无资源内容",icon:"",link:"javascript:;",navname:"日志分析.手机汇总.本网率相关.网内无资源内容",children:[]},
                    {id:2,name:"本网内容",icon:"",link:"javascript:;",navname:"日志分析.手机汇总.本网率相关.本网内容",children:[]},
                    {id:2,name:"缓存内容",icon:"",link:"javascript:;",navname:"日志分析.手机汇总.本网率相关.缓存内容",children:[]},
                    {id:2,name:"移动引入内容",icon:"",link:"javascript:;",navname:"日志分析.手机汇总.本网率相关.移动引入内容",children:[]},
                    {id:2,name:"铁通引入内容",icon:"",link:"javascript:;",navname:"日志分析.手机汇总.本网率相关.铁通引入内容",children:[]},
                    {id:2,name:"直接引入内容",icon:"",link:"javascript:;",navname:"日志分析.手机汇总.本网率相关.直接引入内容",children:[]}
                ]},
                {id:2,name:"引入建议相关",icon:"",link:"javascript:;",navname:"",children:[
                    {id:2,name:"公司引入分析",icon:"",link:"javascript:;",navname:"日志分析.手机汇总.引入建议相关.公司引入分析",children:[]},
                    {id:2,name:"内容引入分析",icon:"",link:"javascript:;",navname:"日志分析.手机汇总.引入建议相关.内容引入分析",children:[]},
                    {id:2,name:"引入偏差全表",icon:"",link:"javascript:;",navname:"日志分析.手机汇总.引入建议相关.引入偏差全表",children:[]},
                    {id:2,name:"缓存引入偏差表",icon:"",link:"javascript:;",navname:"日志分析.手机汇总.引入建议相关.缓存引入偏差表",children:[]},
                    {id:2,name:"移动引入偏差表",icon:"",link:"javascript:;",navname:"日志分析.手机汇总.引入建议相关.移动引入偏差表",children:[]},
                    {id:2,name:"铁通引入偏差表",icon:"",link:"javascript:;",navname:"日志分析.手机汇总.引入建议相关.铁通引入偏差表",children:[]},
                    {id:2,name:"直连引入偏差表",icon:"",link:"javascript:;",navname:"日志分析.手机汇总.引入建议相关.直连引入偏差表",children:[]},
                    {id:2,name:"多点引入资源分析",icon:"",link:"javascript:;",navname:"日志分析.手机汇总.引入建议相关.多点引入资源分析",children:[]},
                    {id:2,name:"缓存去重分析",icon:"",link:"javascript:;",navname:"日志分析.手机汇总.引入建议相关.缓存去重分析",children:[]},
                    {id:2,name:"资源发现表",icon:"",link:"javascript:;",navname:"日志分析.手机汇总.引入建议相关.资源发现表",children:[]}
                ]},
                {id:2,name:"备案相关",icon:"",link:"javascript:;",navname:"",children:[
                    {id:2,name:"域备案信息",icon:"",link:"javascript:;",navname:"日志分析.手机汇总.备案相关.",children:[]},
                    {id:2,name:"未备案域",icon:"",link:"javascript:;",navname:"日志分析.手机汇总.备案相关.",children:[]},
                    {id:2,name:"未备案缓存内容",icon:"",link:"javascript:;",navname:"日志分析.手机汇总.备案相关.",children:[]}
                ]},
                {id:2,name:"本省内容分析",icon:"",link:"javascript:;",navname:"",children:[
                    {id:2,name:"浙江移动IDC",icon:"",link:"javascript:;",navname:"日志分析.手机汇总.综合信息.",children:[
                        {id:2,name:"浙江移动IDC域名",icon:"",link:"javascript:;",navname:"日志分析.手机汇总.综合信息.",children:[]},
                        {id:2,name:"浙江移动IDC域",icon:"",link:"javascript:;",navname:"日志分析.手机汇总.综合信息.",children:[]},
                        {id:2,name:"浙江移动IDC公司",icon:"",link:"javascript:;",navname:"日志分析.手机汇总.综合信息.",children:[]}
                    ]},
                    {id:2,name:"浙江移动直连",icon:"",link:"javascript:;",navname:"",children:[
                        {id:2,name:"浙江移动直连域名",icon:"",link:"javascript:;",navname:"日志分析.手机汇总.综合信息.",children:[]},
                        {id:2,name:"浙江移动直连域",icon:"",link:"javascript:;",navname:"日志分析.手机汇总.综合信息.",children:[]},
                        {id:2,name:"浙江移动直连公司",icon:"",link:"javascript:;",navname:"日志分析.手机汇总.综合信息.",children:[]}
                    ]},
                    {id:2,name:"外省移动直连",icon:"",link:"javascript:;",navname:"",children:[
                        {id:2,name:"外省移动直连域名",icon:"",link:"javascript:;",navname:"日志分析.手机汇总.综合信息.",children:[]},
                        {id:2,name:"外省移动直连域",icon:"",link:"javascript:;",navname:"日志分析.手机汇总.综合信息.",children:[]},
                        {id:2,name:"外省移动直连公司",icon:"",link:"javascript:;",navname:"日志分析.手机汇总.综合信息.",children:[]}
                    ]},
                    {id:2,name:"网宿缓存",icon:"",link:"javascript:;",navname:"",children:[
                        {id:2,name:"网宿缓存域名",icon:"",link:"javascript:;",navname:"日志分析.手机汇总.综合信息.",children:[]},
                        {id:2,name:"网宿缓存域",icon:"",link:"javascript:;",navname:"日志分析.手机汇总.综合信息.",children:[]},
                        {id:2,name:"网宿缓存公司",icon:"",link:"javascript:;",navname:"日志分析.手机汇总.综合信息.",children:[]}
                    ]},
                    {id:2,name:"阿郎缓存",icon:"",link:"javascript:;",navname:"",children:[
                        {id:2,name:"阿郎缓存域名",icon:"",link:"javascript:;",navname:"日志分析.手机汇总.综合信息.",children:[]},
                        {id:2,name:"阿郎缓存域",icon:"",link:"javascript:;",navname:"日志分析.手机汇总.综合信息.",children:[]},
                        {id:2,name:"阿郎缓存公司",icon:"",link:"javascript:;",navname:"日志分析.手机汇总.综合信息.",children:[]}
                    ]},
                    {id:2,name:"华为缓存",icon:"",link:"javascript:;",children:[
                        {id:2,name:"华为缓存域名",icon:"",link:"javascript:;",children:[]},
                        {id:2,name:"华为缓存域",icon:"",link:"javascript:;",children:[]},
                        {id:2,name:"华为缓存公司",icon:"",link:"javascript:;",children:[]}
                    ]},
                    {id:2,name:"树蛙鹏信缓存",icon:"",link:"javascript:;",children:[
                        {id:2,name:"树蛙鹏信缓存域名",icon:"",link:"javascript:;",children:[]},
                        {id:2,name:"树蛙鹏信缓存域",icon:"",link:"javascript:;",children:[]},
                        {id:2,name:"树蛙鹏信缓存公司",icon:"",link:"javascript:;",children:[]}
                    ]},
                    {id:2,name:"网宿CDN",icon:"",link:"javascript:;",children:[
                        {id:2,name:"网宿CDN域名",icon:"",link:"javascript:;",children:[]},
                        {id:2,name:"网宿CDN域",icon:"",link:"javascript:;",children:[]},
                        {id:2,name:"网宿CDN公司",icon:"",link:"javascript:;",children:[]}
                    ]},
                    {id:2,name:"快网CDN",icon:"",link:"javascript:;",children:[
                        {id:2,name:"快网CDN域名",icon:"",link:"javascript:;",children:[]},
                        {id:2,name:"快网CDN域",icon:"",link:"javascript:;",children:[]},
                        {id:2,name:"快网CDN公司",icon:"",link:"javascript:;",children:[]}
                    ]},
                    {id:2,name:"帝联CDN",icon:"",link:"javascript:;",children:[
                        {id:2,name:"帝联CDN域名",icon:"",link:"javascript:;",children:[]},
                        {id:2,name:"帝联CDN域",icon:"",link:"javascript:;",children:[]},
                        {id:2,name:"帝联CDN公司",icon:"",link:"javascript:;",children:[]}
                    ]},
                    {id:2,name:"CDN网段",icon:"",link:"javascript:;",children:[
                        {id:2,name:"CDN网段域名",icon:"",link:"javascript:;",children:[]},
                        {id:2,name:"CDN网段域",icon:"",link:"javascript:;",children:[]},
                        {id:2,name:"CDN网段公司",icon:"",link:"javascript:;",children:[]}
                    ]},
                    {id:2,name:"帝联GSA",icon:"",link:"javascript:;",children:[
                        {id:2,name:"帝联GSA域名",icon:"",link:"javascript:;",children:[]},
                        {id:2,name:"帝联GSA域",icon:"",link:"javascript:;",children:[]},
                        {id:2,name:"帝联GSA公司",icon:"",link:"javascript:;",children:[]}
                    ]},
                ]},
                {id:2,name:"告警",icon:"",link:"javascript:;",children:[
                    {id:2,name:"全部资源告警",icon:"",link:"javascript:;",children:[
                        {id:2,name:"域名告警表",icon:"",link:"javascript:;",children:[]},
                        {id:2,name:"域告警表",icon:"",link:"javascript:;",children:[]},
                        {id:2,name:"公司告警表",icon:"",link:"javascript:;",children:[]},
                        {id:2,name:"重点域名告警表",icon:"",link:"javascript:;",children:[]}
                    ]}
                ]}
            ]},
            {id:2,name:"固网用户",icon:"",link:"javascript:;",children:[]},
            {id:2,name:"其他",icon:"",link:"javascript:;",children:[]},
            {id:2,name:"全部",icon:"",link:"javascript:;",children:[]},
            {id:2,name:"临时需求",icon:"",link:"javascript:;",children:[]},
            {id:2,name:"杭州",icon:"",link:"javascript:;",children:[]},
            {id:2,name:"湖州",icon:"",link:"javascript:;",children:[]},
            {id:2,name:"嘉兴",icon:"",link:"javascript:;",children:[]},
            {id:2,name:"金华",icon:"",link:"javascript:;",children:[]},
            {id:2,name:"丽水",icon:"",link:"javascript:;",children:[]},
            {id:2,name:"宁波",icon:"",link:"javascript:;",children:[]},
            {id:2,name:"衢州",icon:"",link:"javascript:;",children:[]},
            {id:2,name:"绍兴",icon:"",link:"javascript:;",children:[]},
            {id:2,name:"台州",icon:"",link:"javascript:;",children:[]},
            {id:2,name:"温州",icon:"",link:"javascript:;",children:[]},
            {id:2,name:"舟山",icon:"",link:"javascript:;",children:[]}
        ]
    }, {
        id: 1,
        name: "综合分析",
        icon: "fa fa-signal",
        link:"javascript:;",
        children: []
    },{
        id: 1,
        name: "报表定制工具",
        icon: "fa fa-file-o",
        link:"javascript:;",
        children: []
    },{
        id: 1,
        name: "基础库维护",
        icon: "fa fa-cogs",
        link:"javascript:;",
        children: []
    }]
    this.loadHTML=function (menuJson) {
        var navHTML="";
        for(var i=0;i<menuJson.length;i++){
            var menu=menuJson[i];
            navHTML+='<li>';
            if(menu.children.length!=0){
                //active
                navHTML+='<li class="has-sub"><a href="#" name="link" data-url="'+menu.link+'" data-navname="'+menu.navname+'"><i class="'+menu.icon+'"></i><b class="caret pull-right"></b><span>'+menu.name+'</span></a>';
                navHTML+='<ul class="sub-menu">';
                navHTML+=this.loadHTML(menu.children);
                navHTML+='</ul>';
            }
            else {
                if(menu.icon.length==0){
                    navHTML+='<li><a href="#" name="link" data-url="'+menu.link+'" data-navname="'+menu.navname+'">'+menu.name+'</a>';
                }
                else {
                    navHTML+='<li><a href="#" name="link" data-url="'+menu.link+'" data-navname="'+menu.navname+'"><i class="'+menu.icon+'"></i><span>'+menu.name+'</span></a>';
                }
            }
            navHTML+="</li>";
        }
        return navHTML;

    };
    this.appendNav=function () {
        var navHTML='<li class="nav-header">系统菜单</li>';
        navHTML+=this.loadHTML(this.json);
        navHTML+='<li><a href="javascript:;" class="sidebar-minify-btn" data-click="sidebar-minify"><i class="fa fa-angle-double-left"></i></a> </li>'
        $("#navigation").html(navHTML);

        if($("#breadcrumb").html().trim().length==0){
            var navArray=localStorage.getItem("navname").split(".");
            var navNameHTML="";
            for(var i=0;i<navArray.length;i++){
                navNameHTML+="<li>"+navArray[i]+"</li>";
            }
            $("#breadcrumb").html(navNameHTML);
        }
    };
}
var navigation = new navigation();
navigation.appendNav();


